|
|
Mike Raiford wrote:
> Invisible wrote:
>
>> ...so they implemented Java's flawed MI-but-not-MI model? How is that
>> fixing the flaws from other major programming languages?
>
> Ever attempted to use multiple inheritance in C++?
No.
Given that I can't handle C and C++ is more complicated, I figured it
was just a bad idea. ;-)
> Things get really
> interesting when you have more than one base class, and some members
> overlap.
Ever tried to use multiple inheritance in Eiffel?
Since I am presumably the only person here who has ever heard of Eiffel,
let me go over it.
Suppose that class A inherits from classes B and C, which themselves
inherit from D. Suppose that D defines an attribute called, say, banana.
That means that B and C each have a copy of banana. In A, these two
copies are automatically merged by default.
Alternatively, you can rename one (or both) copies to something else.
Stop and think about that for a moment.
Suppose I rename the banan from B to banana_b and the other to banana_c.
That means that anybody who tries to access "banana" through the B
interface actually gets banana_b, anybody trying to access "banana"
through the C interface gets banana_c instead, and anybody trying to
access the A interface directly can see two seperate bananas. A similar
thing happens with methods. [Except that you can override both inherited
methods, or rename one, or...]
It's funny really. Eiffel's slogan is "Simple. Elegant. Powerful." That
first is *highly* debatable...
> Use C# for a while, especially the newer version (3.0) It's actually
> quite nice. I've sort of grown to like it since I've started actually
> using it. C++ish syntax, some stuff borrowed from Java.
It sounds like it's fixed a few of the things that makes C and C++ so
impossible. I'm still not sure I'd like it very much. [And I'm certainly
not keen to shell out money to find out.]
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
|